package com.flyou.ccnucenter.utils;

import java.net.URLEncoder;


import com.flyou.ccnucenter.domain.SmartChatReceiveData;

import com.google.gson.Gson;


public class JsonUtils {
  public static final String TAG = "Json2String";
  public static final String BASEURL="http://www.tuling123.com/openapi/api?key=";
  public static final String APIKEY="91ef9ce0baa4f93d6a13a6a5dc266a88";
  public static final String SPERATOR="&info=";
  private static String jsonString=null;
  public static SmartChatReceiveData msg2Domain(String msg) {
    
    try {
      jsonString = HttpUtils.doGet(BASEURL+APIKEY+SPERATOR+URLEncoder.encode(msg, "utf-8"));
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
    
    Gson gson=new Gson();
    SmartChatReceiveData data = gson.fromJson(jsonString, SmartChatReceiveData.class);
    return data;
  }
}
